import { User } from '../models';
import UserType from '../types/UserType';

const viewer = {
  type: UserType,
  args: {},
  resolve: async (request, { token }, ctx) => {
    const user = await User.findOne({
      where: {
        id: ctx.viewer.id,
      },
    });
    return user;
  }
};

export default { viewer };
